<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    
    <title>缴费记录</title>
   <link href="${ctx}/style/style.css" rel="stylesheet" type="text/css" />
   <script language="JavaScript" src="${ctx}/scripts/jquery.js"></script>
   <script type="text/javascript"
			src="${ctx}/scripts/lhgdialog/lhgdialog.js"></script>	
   <script type="text/javascript" src="${ctx}/scripts/dateTime/WdatePicker.js" ></script>			
   <script type="text/javascript">
		function refund(id){
			 $.ajax({
				url: "Callpaymentrecord_rechargeRefund.action?id="+id,
				type : 'post',
				dataType : 'json',
				beforeSend:function(){
					$("#loading").show();
				},
				dataFilter :function (data, textStatus) {
					$("#loading").hide();
					var result = eval("("+data+")");
					$.dialog.alert(result.data,function(){
	         			if(result.success == 'true'){
		         	    	window.location.reload();
		         		}
		         	});
		        } 
			});
		}
		function sel(){
			document.forms.fom1.submit();
		}
	</script>				
 </head>
 <body >
  	<div class="place" >
	    <span>位置：</span>
	    <ul class="placeul">
	    	<li><a href="#">缴费记录</a></li>
	    </ul>
    </div>
    
    <div class="formtitle"><span>查询</span></div>
    <div class="tools">
    	<form id="fom1" action="Callpaymentrecord_list.action" method="post">
		   <table class="dataTable" style="margin-left: 20px;" width="98%">
		   		<tr>
		   			<th align="right">运营商:</th>
		   			<td >
		   				<s:select name="callpaymentrecord.operatorsnumber" list="operators" listKey="key" listValue="value"
							headerKey="" headerValue="-------请选择-------" cssClass="input" cssStyle="width:130px;" />
		   			</td>
		   			
		   			<th align="right">充值号码:</th>
		   			<td >
						<s:textfield name="callpaymentrecord.mobilephone" cssClass="input" cssStyle="width:130px;"/>
					</td>
		   			<th align="right" >充值状态:</th>
		   			<td >
		   				<s:select name="callpaymentrecord.status" cssStyle="width:130px;"
							list="#{'0':'缴费中','1':'成功','2':'已退款'}" listKey="key" listValue="value"
							headerKey="" headerValue="---------请选择------" cssClass="input" />
		   			</td>
		   			<td align="right" rowspan="2">
				        <ul class="toolbar1"  >
				        	<li onclick="sel()"><span><img src="${ctx}/images/search.png" /></span>查询</li>
				        </ul>
		   			</td>
		   		</tr>
		   		<tr>
			   		<th align="right" height="25">缴费时间:</th>
		   			<s:if test="#session.sysUser.agentlevel == 2">
			   			<td colspan="5">
			   				<s:textfield cssClass="input" name="callpaymentrecord.start_time" cssStyle="width:130px;"
								onclick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" />
							~
							<s:textfield cssClass="input" name="callpaymentrecord.end_time" cssStyle="width:130px;"
								onclick="WdatePicker({startDate:'%y-%M-%d 23:59:59',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" />
			   			</td>
		   			</s:if>
		   			<s:else>
		   				<td colspan="3">
			   				<s:textfield cssClass="input" name="callpaymentrecord.start_time" cssStyle="width:130px;"
								onclick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" />
							~
							<s:textfield cssClass="input" name="callpaymentrecord.end_time" cssStyle="width:130px;"
								onclick="WdatePicker({startDate:'%y-%M-%d 23:59:59',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" />
			   			</td>
		   				<th align="right">代理商名称:</th>
		   				<td>
			   				<s:select name="callpaymentrecord.agentname" list="agentaccountinfoList" listKey="username" listValue="truename"
							headerKey="" headerValue="-------请选择-------" cssClass="input" cssStyle="width:130px;"/>
		   				</td>
		   			</s:else>
		   		</tr>
		   </table>
		 </form>
    </div>
    
    	
   	<div class="formtitle" ><span>统计</span></div>
    <table class="dataTable" width="98%" style="margin-left: 20px;margin-bottom:5px;">
   		<tr >
   			<th  height="25" align="right">总次数:</th>
   			<td width="10%">
   				<s:property value="count_num"/>
   			</td>
   			<th  align="right">成功次数:</th>
   			<td width="10%">
   				<s:property value="count_yes_num"/>
   			</td>
   			<th   align="right">缴费中次数:</th>
   			<td width="10%">
   				<s:property value="count_no_num"/>
   			</td>
   			<th  align="right">退款次数:</th>
   			<td width="10%">
   				<s:property value="count_refund_num"/>
   			</td>
   		</tr>
   		<tr>
   			<th align="right"  height="25">金额总计(元):</th>
   			<td>
   				<s:property value="count_money"/>
   			</td>
   			<th align="right">成功金额(元):</th>
   			<td>
   				<s:property value="count_yes_money"/>
   			</td>
   			<th align="right">缴费中金额(元):</th>
   			<td>
   				<s:property value="count_no_money"/>
   			</td>
   			<th align="right">退款金额(元):</th>
   			<td>
   				<s:property value="count_refund_money"/>
   			</td>
   		</tr>
   </table>
   
    <table class="imgtable" id="imgtable" style="width: 100%">
	    <thead>
		    <tr>
		    	<th align="center">编号</th>
			    <th align="center">流水号</th>
			    <s:if test="#session.sysUser.agentlevel == 1">
			    	 <th align="center">代理商名称</th>
			    </s:if>
			    <th align="center">缴费时间</th>
			    <th align="center">缴费号码</th>
			    <th align="center">号码运营商</th>
			    <th align="center">上次余额</th>
			    <th align="center">充值金额</th>
			    <th align="center">实收金额</th>
			    <th align="center">充值状态</th>
			    <th align="center">本次余额</th>
		    </tr>
	    </thead>
	    <tbody>
	    	<s:if test="callpaymentrecordList==null || callpaymentrecordList.isEmpty()">
				<tr class="toolbar" height="25">
					<td colspan="10" align="left" height="25px">
						<font color="red">提示：未查询到数据!</font>
					</td>
				</tr>
			</s:if>
			<s:else>
				<s:iterator id="c" value="callpaymentrecordList" status="loop">
					<tr >
					    <td width="30"><s:property  value="#loop.index+1" />&nbsp;</td>
					    <td style="width: 80px;"><s:property  value="#c.serialnumber" /></td>
					    <s:if test="#session.sysUser.agentlevel == 1">
					    	 <td align="center">
					    	 	<s:iterator id="a" value="agentaccountinfoList" status="loopp">
					    	 		<s:if test="#a.username == #c.agentname">
					    	 			<s:property  value="#a.truename" />
					    	 		</s:if>
					    	 	</s:iterator>
							</td>
					    </s:if>
					    <td><s:property  value="#c.occurtime" /></td>
					    <td><s:property  value="#c.mobilephone" /></td>
					    <td ><s:property  value="#c.operators" /></td>
					    <td ><s:property  value="#c.beforebalance" /></td>
					    <td ><s:property  value="#c.paymentmoney" /></td>
					    <td ><s:property  value="#c.agentprice" /></td>
					    <td>
					    	<s:if test="#c.status == 0">
					    		<font color="#458B00">缴费中</font>
					    	</s:if> 	
					    	<s:elseif test="#c.status == 1">
					    		<font color="blue">成功</font>
					    	</s:elseif>
					    	<s:elseif test="#c.status == 2">
					    		<font  color="red">已退款</font>
					    	</s:elseif>
					    	<s:elseif test="#c.status == 3">
					    		<font color="#458B00">缴费中</font>
					    		<input type="button" value="退款" onclick="refund('<s:property  value="#c.id" />')"   class="btn" style="width: 35px;height: 18px;font-size: 10px;font-weight: 200" />
					    	</s:elseif>
					     &nbsp;
					    </td>
					    <td style="width: 80px">
					    	<s:if test="#c.status == 1">
					    		<s:property  value="#c.afterbalance" />
					    	</s:if>
					    	<s:else>
					    		--
					    	</s:else>
					     &nbsp;
					    </td>
				    </tr>
				</s:iterator>
			</s:else>
	    </tbody>
    </table>
    <div class="pagin">
    	<div class="message">
			共
			<s:property value="totalCount" />
			条记录&nbsp;共
			<s:property value="totalPage" />
			页&nbsp;当前第
			<s:property value="currentPage" />
			页&nbsp;
		</div>
        <ul class="paginList">
	        <li class="paginItem">
				<pagetag:pages currentPage="${currentPage}"
					totalPage="${totalPage}" styleClass="page" theme="text">
					<input type="hidden" name="callpaymentrecord.start_time"
						value="${callpaymentrecord.start_time}" />
					<input type="hidden" name="callpaymentrecord.end_time"
						value="${callpaymentrecord.end_time}" />
					<input type="hidden" name="callpaymentrecord.operatorsnumber"
						value="${callpaymentrecord.operatorsnumber}" />
					<input type="hidden" name="callpaymentrecord.mobilephone"
						value="${callpaymentrecord.mobilephone}" />
					<input type="hidden" name="callpaymentrecord.status"
						value="${callpaymentrecord.status}" />
					<input type="hidden" name="callpaymentrecord.agentname"
						value="${callpaymentrecord.agentname}" />				
				</pagetag:pages>
			</li>
        </ul>
    </div>
   
	<script type="text/javascript">
		$('#imgtable tr:odd').addClass('odd');
	</script>
	<div id="loading" style="position:absolute; display:none; left:-1px; top:1px; width:100%; height:100%; background-color:#FFFFFF; 
			filter:alpha(opacity=50);-moz-opacity:0.5; -khtml-opacity: 0.5;opacity: 0.5; z-index:1000;"> 
		<div  style="position:absolute;left:180px;top:150px;width:100px;height:100px;background-color:#FFFFFF; z-index:9001;" >
			<img alt="" id="wait1" src="${ctx}/images/loading.gif" >
		</div>
	</div>
  </body>
</html>
